package com.mebius.common.web.model;

import java.util.List;

import com.mebius.common.Constants;

public class Pager<T> {

	//当前页
	private int currentPage = 1 ;
	
	//每页显示条数
	private int pageNumber = Constants.PAGE_NUMBER ;
	
	//总页数
	private int totalPage ;
	
	//总条数
	private int totalNumber ;
	
	//查询的数据
	private List<?> dataRows ;

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getPageNumber() {
		return pageNumber;
	}

	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}

	public int getTotalPage() {
		if(this.getTotalNumber()%this.getPageNumber() == 0) {
			totalPage = (int) (this.getTotalNumber() / this.getPageNumber()) ;
		} else {
			totalPage = (int) (this.getTotalNumber() / this.getPageNumber())+1 ;
		}
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public int getTotalNumber() {
		return totalNumber;
	}

	public void setTotalNumber(int totalNumber) {
		this.totalNumber = totalNumber;
	}

	public List<?> getDataRows() {
		return dataRows;
	}

	public void setDataRows(List<?> dataRows) {
		this.dataRows = dataRows;
	}
}
